
//
//  CustomeManager.m
//  KamunShangCheng
//
//  Created by Michael Li on 2018/7/31.
//  Copyright © 2018年 Michael Li. All rights reserved.
//

#import "CustomeManager.h"
@interface CustomeManager()

@end
@implementation CustomeManager
+ (void)POSTWithURLIndex:(int )index
               parameters:(id)parameters
                  success:(SuccessBlock)successBlock
                  failure:(FailureBlock)failureBlock
{
    NSArray *tempURL = @[@"/user/checkToken",//0
                         @"/user/login",//1
                         @"/user/loginByCode",//2
                         @"/user/loginByQQ",//3
                         @"/user/loginByQQBind",//4
                         @"/user/loginByWecha",//5
                         @"/user/loginByWechatBind",//6
                         @"/user/rePassword",//7
                         @"/user/register",//8
                         @"/user/smsSend",//9
                         @"/associationType/list",//10
                         @"/associationTypeSub/listByFatherId",//11
                         @"/banner/selectAllBanner",//12
                         @"/demand/selectDemandByIndustryIds",//13
                         @"/association/listNew",//14
                         @"/shop/shopSerch",//15
                         @"/shop/selectShopByUid",//16
                         @"/Demandevaluation/selectDemandBelieve",//17
                         @"/associationEvaluate/updateSupportCount",//18
                         @"/association/indexSearch",//19
                         @"/demand/selectIndexDemand",//20
                         @"/demand/selectDemandByIds",//21
                         @"/association/listByIds",//22
                         @"/message/selectAllMessage",//23
                         @"/association/search",//24
                         @"/collection/collectionRecommend",//25
                         @"/collection/collectionDemand",//26
                         @"/collection/collectionShop",//27
                         @"/associationEvaluate/list",//28
                         @"/association/collects",//29
                         @"/demand/selectDemandByUid",//30
                         @"/relation/selectRelation",//31
                         @"/userfeedback/insert",//32
                         @"/demand/selectTodayDemand",//33
                         @"/collection/insertCollection",//34
                         @"/demand/selectTranslateDemand",//35
                         @"/association/save",//36
                         @"/demand/insertDemand",//37
                         @"/place/list",//38
                         @"/relation/updateRelation",//39
                         @"/associationEvaluate/save",//40
                         @"/place/selectList",//41
                         @"/certification/insert",//42
                         @"/simplecertification/insert",//43
                         @"/demand/selectReleaseDemand",//44
                         @"/association/release",//45
                         @"/associationEvaluate/listByMUid",//46
                         @"/shop/update",//47
                         @"/hotSeach/list",//48
                         @"/collection/updateTime",//49
                         @"/shop/selectMyShopByUid",//50
                         @"/association/shop",//51
                         @"/demand/updateDemand",//52
                         @"/demand/selectShelvesDemand",//53
                         @"/demand/delectDemand",//54
                         @"/demand/downShelves",//55
                         @"/demand/onShelves",//56
                         @"/association/delete",//57
                         @"/association/off",//58
                         @"/association/up",//59
                         @"/user/updatePassword",//60
                         @"/association/update",//61
                         @"/simplecertification/Authenticationstatus",//62
                         @"/history/insertDemand",//63
                         @"/history/demandList",//64
                         @"/history/insertAssociation",//65
                         @"/association/history",//66
                         @"/history/deleteDemandHistory",//67
                         @"/history/deleteAssociationHistory",//68
                         @"/demand/selectDemandByTime",//69
                         @"/icon/selectRelease",//70
                         @"/demand/selectDemandByComment",//71
                         @"/version/check",//72
                         @"/banner/guidepage",//73
                         @"/user/updateAgreement",//74
                         @"/simplecertification/selectCertification",//75
                         @"/association/shopSearch",//76
                         @"/demand/selectMyShopDemand"//77
                         ];
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
   NSString *urlString = [NSString stringWithFormat:@"%@%@",kUrl,tempURL[index]];
//    XLog(@"urlString:%@",urlString);
    [manager POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        if (successBlock) {
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:nil];
            successBlock(dic);
            NSInteger integer = [[dic objectForKey:@"status"] intValue] ;
            NSDictionary *date = [dic objectForKey:@"date"];
            if (integer == 200) {
                switch (index) {
                    case 0:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkToken" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 1:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiulogin" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 2:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuloginByCode" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 3:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuloginloginByQQ" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 4:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuloginloginByQQBind" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 5:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuloginByWecha" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 6:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuloginByWechatBind" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 7:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiurePassword" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 8:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuregister" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 9:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiusmsSend" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 10:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiulist" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 11:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiulistlistByFatherId" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 12:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"qingqiuHomeBanner" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 13:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectTowDemandRecommend" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 14:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationlistNew" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 15:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"shopSerch" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 16:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectShopByUid" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 17:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectDemandBelieve" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 18:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"updateSupportCount" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 19:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationindexSearch" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 20:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandselectIndexDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 21:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectDemandByIds" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 22:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"listByIds" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 23:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectAllMessage" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 24:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationSearch" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 25:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"collectioncollectionRecommend" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 26:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"collectioncollectionDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 27:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"collectionShop" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 28:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationEvaluatelist" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 29:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationcollects" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 30:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandselectDemandByUid" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 31:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"relationselectRelation" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 32:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"userfeedback" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 33:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectTodayDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 34:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"insertCollection" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 35:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectTranslateDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 36:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationsave" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 37:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandinsertDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 38:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"usuallyplacelist" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 39:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"updateRelation" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 40:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationEvaluatesave" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 41:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"placeselectList" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 42:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"certificationinsert" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 43:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"simplecertificationinsert" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 44:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandselectReleaseDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 45:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationrelease" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 46:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationEvaluatelistByMUid" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 47:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"shopupdate" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 48:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"hotSeachlist" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 49:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"collectionupdateTime" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 50:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectMyShopByUid" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 51:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationshop" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 52:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandupdateDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 53:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectShelvesDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 54:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"delectDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 55:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"downShelves" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 56:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"onShelves" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 57:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationdelete" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 58:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationoff" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 59:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationup" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 60:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"updatePassword" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 61:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationupdate" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 62:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"simplecertification" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 63:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"historyinsertDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 64:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"historydemandLis" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 65:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"historyinsertAssociation" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 66:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationhistory" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 67:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"deleteDemandHistory" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 68:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"deleteAssociationHistory" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 69:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectDemandByTime" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 70:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectReleaseIcon" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 71:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"selectDemandByComment" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 72:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkVersion" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 73:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"guidepage" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 74:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"updateAgreement" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 75:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkCertification" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 76:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"associationshopSearch" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 77:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"demandselectMyShopDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    default:
                        break;
                }
                
            }else {
                NSNotification *notification = [NSNotification notificationWithName:@"qingqiusibai" object:nil userInfo:dic];
                [[NSNotificationCenter defaultCenter]postNotification:notification];
                 [WSProgressHUD dismiss];
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (failureBlock) {
            failureBlock(error);
            XLog(@"网络异常 - T_T%@", error);
            if (index != 63&&index != 64&&index != 66 &&index != 66) {
//                [WSProgressHUD showImage:[UIImage imageNamed:@""] status:[NSBundle bundleLocalizedStringForKey:@"footerNoInternet"]];
                
            }
            
//            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [WSProgressHUD dismiss];
//                NSNotification *notification = [NSNotification notificationWithName:@"qingqiusibai" object:nil];
//                [[NSNotificationCenter defaultCenter]postNotification:notification];
//            });
        }

    }];
}
+ (void)POSTCheckTokenWithURLIndex:(int )index
                        parameters:(id)parameters
                           success:(SuccessBlock)successBlock
                           failure:(FailureBlock)failureBlock
{
    NSArray *tempURL = @[@"/user/checkToken",//0
                         @"/user/checkToken",//1
                         @"/user/checkToken",//2
                         @"/user/checkToken",//3
                         @"/user/checkToken",//4
                         @"/user/checkToken",//5
                         @"/user/checkToken",//6
                         @"/user/checkToken",//7
                         @"/user/checkToken",//8
                         @"/user/checkToken"//9
                         ];
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    NSString *urlString = [NSString stringWithFormat:@"%@%@",kUrl,tempURL[index]];
    //    XLog(@"urlString:%@",urlString);
    [manager POST:urlString parameters:parameters progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        if (successBlock) {
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:nil];
            successBlock(dic);
            NSInteger integer = [[dic objectForKey:@"status"] intValue] ;
            if (integer == 200) {
                switch (index) {
                    case 0:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenMainTabBar" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 1:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenLogIn" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 2:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenFunction" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 3:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenFunctionDemand" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 4:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenDemandTheHall" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 5:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenServiceContent" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 6:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenServiceContentCallPhone" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 7:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenMyCollection" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    case 8:
                    {
                        NSNotification *notification = [NSNotification notificationWithName:@"checkTokenSetting" object:nil userInfo:dic];
                        [[NSNotificationCenter defaultCenter]postNotification:notification];
                    }
                        break;
                    default:
                        break;
                }
                
            }else {
                NSNotification *notification = [NSNotification notificationWithName:@"checkTokenError" object:nil userInfo:dic];
                [[NSNotificationCenter defaultCenter]postNotification:notification];
                [WSProgressHUD dismiss];
            }
        }
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        if (failureBlock) {
            failureBlock(error);
            XLog(@"网络异常 - T_T%@", error);
            if (index != 63&&index != 64&&index != 66 &&index != 66) {
                
                //                [WSProgressHUD showImage:[UIImage imageNamed:@""] status:@"网络异常"];
            }
            
            //            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            //                [WSProgressHUD dismiss];
            NSNotification *notification = [NSNotification notificationWithName:@"checkTokenError" object:nil];
            [[NSNotificationCenter defaultCenter]postNotification:notification];
            //            });
        }
        
    }];
}
@end
